package com.itdfq.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itdfq.dao.YujingDao;
import com.itdfq.model.Yujing;
import com.itdfq.service.YujingService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional(rollbackFor = Exception.class)
public class YujingServiceImpl  implements YujingService {
    @Resource
    private YujingDao yujingDao;

    @Transactional(readOnly = true)
    @Override
    public PageInfo<Yujing> findByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return PageInfo.of(yujingDao.findByPage());
    }


    @Override
    public void delete(Yujing id) {
            yujingDao.delete(id);
    }


    @Override
    public void insert(Yujing yujing) {
        yujingDao.insert(yujing);
    }
}
